microtime to date php

102

microtime to date php -

$now = DateTime::createFromFormat('U.u', microtime(true));
echo $now->format("m-d-Y H:i:s.u");

php microtime to seconds -

echo date("H:i:s",$endtime-$starttime);

$duration = $endtime-$starttime;
$hours = (int)($duration/60/60);
$minutes = (int)($duration/60)-$hours*60;
$seconds = (int)$duration-$hours*60*60-$minutes*60;

Comments

Submit
0 Comments